<template>
  <div class="header_top" id="header_top">
    <i class="iconfont icon-return"  @click="back" v-if="isshow"></i>
    <h2>{{headerTitle}}</h2>
    <i class="iconfont icon-people"></i>
  </div>
</template>

<script>
  export default {
    name: 'MainHeader',
    data () {
      return {
        headerTitle: '首页理想国际大厦海定区',
        isshow:false
      }
    },
//    监听路由
    watch:{
        '$route':function(newrou,oldrou){
          if(newrou.path.toLowerCase() == '/main/home'){
              this.isshow = false;
          }else{
              this.isshow = true;
          }
      }
    },
    methods: {
      back() {
        history.back()
      }
    }
  }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
  @import "../../static/css/iconfont.css";
.header_top{
  width: 100%;
  position: fixed;
  top:0;
  height: .5rem;
  color:#fff;
  background-color: #52caed;
  z-index: 10;
}
  .header_top i{
    position: absolute;
    top:.1rem;
    font-size: .24rem;
  }
  .header_top .icon-return{
    left:.1rem;
  }
  .header_top .icon-people{
    right:.1rem;
  }
  .header_top h2{
    font-size: .18rem;
    height: 100%;
    font-weight:normal;
    text-align: center;
    line-height:.5rem;
  }
</style>
